import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class DynamicRegularExpression {

	public static void main(String[] args) {
		String text = "Available downloads: Java 5.0 SE \\b for Windows, " +
			"Java 5.0 \\b for Linux, Sun One Studio, Java Micro Edition (Nokia)";
		String word = "\\b";//"Java 5.0";
		String quotedWord = word;//Pattern.quote(word);
		System.out.println("The quoted word is: " + quotedWord);
		//Pattern pattern = Pattern.compile("\\b" + quotedWord + "\\b");
		Pattern pattern = Pattern.compile(quotedWord, Pattern.LITERAL);
		//Pattern pattern = Pattern.compile(quotedWord);
		Matcher matcher = pattern.matcher(text);
		while (matcher.find()) {
			  System.out.println("Position: " + matcher.start());
		}
	}
	
	
}
